<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-comment">-- | Fast access to the system clock.</span><span>
</span><span id="line-2"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">Data.Time.Clock.System</span><span>
</span><span id="line-3"></span><span class="hs-special">(</span><span>
</span><span id="line-4"></span><span>    </span><span class="annot"><a href="Data.Time.Clock.System.html#systemEpochDay"><span class="hs-identifier">systemEpochDay</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-5"></span><span>    </span><span class="annot"><a href="Data.Time.Clock.Internal.SystemTime.html#SystemTime"><span class="hs-identifier">SystemTime</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-6"></span><span>    </span><span class="annot"><a href="Data.Time.Clock.System.html#truncateSystemTimeLeapSecond"><span class="hs-identifier">truncateSystemTimeLeapSecond</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-7"></span><span>    </span><span class="annot"><a href="Data.Time.Clock.Internal.SystemTime.html#getSystemTime"><span class="hs-identifier">getSystemTime</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-8"></span><span>    </span><span class="annot"><a href="Data.Time.Clock.System.html#systemToUTCTime"><span class="hs-identifier">systemToUTCTime</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-9"></span><span>    </span><span class="annot"><a href="Data.Time.Clock.System.html#utcToSystemTime"><span class="hs-identifier">utcToSystemTime</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-10"></span><span>    </span><span class="annot"><a href="Data.Time.Clock.System.html#systemToTAITime"><span class="hs-identifier">systemToTAITime</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-11"></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-12"></span><span>
</span><span id="line-13"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.Time.Clock.Internal.AbsoluteTime.html"><span class="hs-identifier">Data.Time.Clock.Internal.AbsoluteTime</span></a></span><span>
</span><span id="line-14"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.Time.Clock.Internal.DiffTime.html"><span class="hs-identifier">Data.Time.Clock.Internal.DiffTime</span></a></span><span>
</span><span id="line-15"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.Time.Clock.Internal.SystemTime.html"><span class="hs-identifier">Data.Time.Clock.Internal.SystemTime</span></a></span><span>
</span><span id="line-16"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.Time.Clock.Internal.UTCTime.html"><span class="hs-identifier">Data.Time.Clock.Internal.UTCTime</span></a></span><span>
</span><span id="line-17"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.Time.Calendar.Days.html"><span class="hs-identifier">Data.Time.Calendar.Days</span></a></span><span>
</span><span id="line-18"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Int.html#"><span class="hs-identifier">Data.Int</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Int.html#Int64"><span class="hs-identifier">Int64</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-19"></span><span>
</span><span id="line-20"></span><span>
</span><span id="line-21"></span><span class="hs-comment">-- | Map leap-second values to the start of the following second.</span><span>
</span><span id="line-22"></span><span class="hs-comment">-- The resulting 'systemNanoseconds' will always be in the range 0 to 1E9-1.</span><span>
</span><span id="line-23"></span><span class="annot"><a href="Data.Time.Clock.System.html#truncateSystemTimeLeapSecond"><span class="hs-identifier hs-type">truncateSystemTimeLeapSecond</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Time.Clock.Internal.SystemTime.html#SystemTime"><span class="hs-identifier hs-type">SystemTime</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Time.Clock.Internal.SystemTime.html#SystemTime"><span class="hs-identifier hs-type">SystemTime</span></a></span><span>
</span><span id="line-24"></span><span id="truncateSystemTimeLeapSecond"><span class="annot"><span class="annottext">truncateSystemTimeLeapSecond :: SystemTime -&gt; SystemTime
</span><a href="Data.Time.Clock.System.html#truncateSystemTimeLeapSecond"><span class="hs-identifier hs-var hs-var">truncateSystemTimeLeapSecond</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Time.Clock.Internal.SystemTime.html#MkSystemTime"><span class="hs-identifier hs-type">MkSystemTime</span></a></span><span> </span><span id="local-6989586621679070697"><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679070697"><span class="hs-identifier hs-var">seconds</span></a></span></span><span> </span><span id="local-6989586621679070696"><span class="annot"><span class="annottext">Word32
</span><a href="#local-6989586621679070696"><span class="hs-identifier hs-var">nanoseconds</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Word32
</span><a href="#local-6989586621679070696"><span class="hs-identifier hs-var">nanoseconds</span></a></span><span> </span><span class="annot"><span class="annottext">Word32 -&gt; Word32 -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&gt;=</span></span><span> </span><span class="annot"><span class="annottext">Word32
</span><span class="hs-number">1000000000</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Word32 -&gt; SystemTime
</span><a href="Data.Time.Clock.Internal.SystemTime.html#MkSystemTime"><span class="hs-identifier hs-var">MkSystemTime</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int64 -&gt; Int64
forall a. Enum a =&gt; a -&gt; a
</span><a href="../../base/src/GHC.Enum.html#succ"><span class="hs-identifier hs-var">succ</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679070697"><span class="hs-identifier hs-var">seconds</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Word32
</span><span class="hs-number">0</span></span><span>
</span><span id="line-25"></span><span class="annot"><a href="Data.Time.Clock.System.html#truncateSystemTimeLeapSecond"><span class="hs-identifier hs-var">truncateSystemTimeLeapSecond</span></a></span><span> </span><span id="local-6989586621679070694"><span class="annot"><span class="annottext">SystemTime
</span><a href="#local-6989586621679070694"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SystemTime
</span><a href="#local-6989586621679070694"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-26"></span><span>
</span><span id="line-27"></span><span class="hs-comment">-- | Convert 'SystemTime' to 'UTCTime', matching zero 'SystemTime' to midnight of 'systemEpochDay' UTC.</span><span>
</span><span id="line-28"></span><span class="annot"><a href="Data.Time.Clock.System.html#systemToUTCTime"><span class="hs-identifier hs-type">systemToUTCTime</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Time.Clock.Internal.SystemTime.html#SystemTime"><span class="hs-identifier hs-type">SystemTime</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Time.Clock.Internal.UTCTime.html#UTCTime"><span class="hs-identifier hs-type">UTCTime</span></a></span><span>
</span><span id="line-29"></span><span id="systemToUTCTime"><span class="annot"><span class="annottext">systemToUTCTime :: SystemTime -&gt; UTCTime
</span><a href="Data.Time.Clock.System.html#systemToUTCTime"><span class="hs-identifier hs-var hs-var">systemToUTCTime</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Time.Clock.Internal.SystemTime.html#MkSystemTime"><span class="hs-identifier hs-type">MkSystemTime</span></a></span><span> </span><span id="local-6989586621679070693"><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679070693"><span class="hs-identifier hs-var">seconds</span></a></span></span><span> </span><span id="local-6989586621679070692"><span class="annot"><span class="annottext">Word32
</span><a href="#local-6989586621679070692"><span class="hs-identifier hs-var">nanoseconds</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span>
</span><span id="line-30"></span><span>    </span><span class="annot"><a href="#local-6989586621679070691"><span class="hs-identifier hs-type">days</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int64"><span class="hs-identifier hs-type">Int64</span></a></span><span>
</span><span id="line-31"></span><span>    </span><span class="annot"><a href="#local-6989586621679070690"><span class="hs-identifier hs-type">timeSeconds</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int64"><span class="hs-identifier hs-type">Int64</span></a></span><span>
</span><span id="line-32"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621679070691"><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679070691"><span class="hs-identifier hs-var">days</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679070690"><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679070690"><span class="hs-identifier hs-var">timeSeconds</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679070693"><span class="hs-identifier hs-var">seconds</span></a></span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int64 -&gt; (Int64, Int64)
forall a. Integral a =&gt; a -&gt; a -&gt; (a, a)
</span><a href="../../base/src/GHC.Real.html#divMod"><span class="hs-operator hs-var">`divMod`</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><span class="hs-number">86400</span></span><span>
</span><span id="line-33"></span><span>
</span><span id="line-34"></span><span>    </span><span class="annot"><a href="#local-6989586621679070686"><span class="hs-identifier hs-type">day</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Time.Calendar.Days.html#Day"><span class="hs-identifier hs-type">Day</span></a></span><span>
</span><span id="line-35"></span><span>    </span><span id="local-6989586621679070686"><span class="annot"><span class="annottext">day :: Day
</span><a href="#local-6989586621679070686"><span class="hs-identifier hs-var hs-var">day</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Day -&gt; Day
</span><a href="Data.Time.Calendar.Days.html#addDays"><span class="hs-identifier hs-var">addDays</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int64 -&gt; Integer
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679070691"><span class="hs-identifier hs-var">days</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Day
</span><a href="Data.Time.Clock.System.html#systemEpochDay"><span class="hs-identifier hs-var">systemEpochDay</span></a></span><span>
</span><span id="line-36"></span><span>
</span><span id="line-37"></span><span>    </span><span class="annot"><a href="#local-6989586621679070684"><span class="hs-identifier hs-type">timeNanoseconds</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int64"><span class="hs-identifier hs-type">Int64</span></a></span><span>
</span><span id="line-38"></span><span>    </span><span id="local-6989586621679070684"><span class="annot"><span class="annottext">timeNanoseconds :: Int64
</span><a href="#local-6989586621679070684"><span class="hs-identifier hs-var hs-var">timeNanoseconds</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679070690"><span class="hs-identifier hs-var">timeSeconds</span></a></span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int64 -&gt; Int64
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><span class="hs-number">1000000000</span></span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int64 -&gt; Int64
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word32 -&gt; Int64
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Word32
</span><a href="#local-6989586621679070692"><span class="hs-identifier hs-var">nanoseconds</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-39"></span><span>
</span><span id="line-40"></span><span>    </span><span class="annot"><a href="#local-6989586621679070681"><span class="hs-identifier hs-type">timePicoseconds</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int64"><span class="hs-identifier hs-type">Int64</span></a></span><span>
</span><span id="line-41"></span><span>    </span><span id="local-6989586621679070681"><span class="annot"><span class="annottext">timePicoseconds :: Int64
</span><a href="#local-6989586621679070681"><span class="hs-identifier hs-var hs-var">timePicoseconds</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679070684"><span class="hs-identifier hs-var">timeNanoseconds</span></a></span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int64 -&gt; Int64
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><span class="hs-number">1000</span></span><span>
</span><span id="line-42"></span><span>
</span><span id="line-43"></span><span>    </span><span class="annot"><a href="#local-6989586621679070680"><span class="hs-identifier hs-type">time</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Time.Clock.Internal.DiffTime.html#DiffTime"><span class="hs-identifier hs-type">DiffTime</span></a></span><span>
</span><span id="line-44"></span><span>    </span><span id="local-6989586621679070680"><span class="annot"><span class="annottext">time :: DiffTime
</span><a href="#local-6989586621679070680"><span class="hs-identifier hs-var hs-var">time</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; DiffTime
</span><a href="Data.Time.Clock.Internal.DiffTime.html#picosecondsToDiffTime"><span class="hs-identifier hs-var">picosecondsToDiffTime</span></a></span><span> </span><span class="annot"><span class="annottext">(Integer -&gt; DiffTime) -&gt; Integer -&gt; DiffTime
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Integer
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679070681"><span class="hs-identifier hs-var">timePicoseconds</span></a></span><span>
</span><span id="line-45"></span><span>    </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">Day -&gt; DiffTime -&gt; UTCTime
</span><a href="Data.Time.Clock.Internal.UTCTime.html#UTCTime"><span class="hs-identifier hs-var">UTCTime</span></a></span><span> </span><span class="annot"><span class="annottext">Day
</span><a href="#local-6989586621679070686"><span class="hs-identifier hs-var">day</span></a></span><span> </span><span class="annot"><span class="annottext">DiffTime
</span><a href="#local-6989586621679070680"><span class="hs-identifier hs-var">time</span></a></span><span>
</span><span id="line-46"></span><span>
</span><span id="line-47"></span><span class="hs-comment">-- | Convert 'UTCTime' to 'SystemTime', matching zero 'SystemTime' to midnight of 'systemEpochDay' UTC.</span><span>
</span><span id="line-48"></span><span class="annot"><a href="Data.Time.Clock.System.html#utcToSystemTime"><span class="hs-identifier hs-type">utcToSystemTime</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Time.Clock.Internal.UTCTime.html#UTCTime"><span class="hs-identifier hs-type">UTCTime</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Time.Clock.Internal.SystemTime.html#SystemTime"><span class="hs-identifier hs-type">SystemTime</span></a></span><span>
</span><span id="line-49"></span><span id="utcToSystemTime"><span class="annot"><span class="annottext">utcToSystemTime :: UTCTime -&gt; SystemTime
</span><a href="Data.Time.Clock.System.html#utcToSystemTime"><span class="hs-identifier hs-var hs-var">utcToSystemTime</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Time.Clock.Internal.UTCTime.html#UTCTime"><span class="hs-identifier hs-type">UTCTime</span></a></span><span> </span><span id="local-6989586621679070677"><span class="annot"><span class="annottext">Day
</span><a href="#local-6989586621679070677"><span class="hs-identifier hs-var">day</span></a></span></span><span> </span><span id="local-6989586621679070676"><span class="annot"><span class="annottext">DiffTime
</span><a href="#local-6989586621679070676"><span class="hs-identifier hs-var">time</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span>
</span><span id="line-50"></span><span>    </span><span class="annot"><a href="#local-6989586621679070675"><span class="hs-identifier hs-type">days</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int64"><span class="hs-identifier hs-type">Int64</span></a></span><span>
</span><span id="line-51"></span><span>    </span><span id="local-6989586621679070675"><span class="annot"><span class="annottext">days :: Int64
</span><a href="#local-6989586621679070675"><span class="hs-identifier hs-var hs-var">days</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Int64
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">(Integer -&gt; Int64) -&gt; Integer -&gt; Int64
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Day -&gt; Day -&gt; Integer
</span><a href="Data.Time.Calendar.Days.html#diffDays"><span class="hs-identifier hs-var">diffDays</span></a></span><span> </span><span class="annot"><span class="annottext">Day
</span><a href="#local-6989586621679070677"><span class="hs-identifier hs-var">day</span></a></span><span> </span><span class="annot"><span class="annottext">Day
</span><a href="Data.Time.Clock.System.html#systemEpochDay"><span class="hs-identifier hs-var">systemEpochDay</span></a></span><span>
</span><span id="line-52"></span><span>
</span><span id="line-53"></span><span>    </span><span class="annot"><a href="#local-6989586621679070673"><span class="hs-identifier hs-type">timePicoseconds</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int64"><span class="hs-identifier hs-type">Int64</span></a></span><span>
</span><span id="line-54"></span><span>    </span><span id="local-6989586621679070673"><span class="annot"><span class="annottext">timePicoseconds :: Int64
</span><a href="#local-6989586621679070673"><span class="hs-identifier hs-var hs-var">timePicoseconds</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Int64
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">(Integer -&gt; Int64) -&gt; Integer -&gt; Int64
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">DiffTime -&gt; Integer
</span><a href="Data.Time.Clock.Internal.DiffTime.html#diffTimeToPicoseconds"><span class="hs-identifier hs-var">diffTimeToPicoseconds</span></a></span><span> </span><span class="annot"><span class="annottext">DiffTime
</span><a href="#local-6989586621679070676"><span class="hs-identifier hs-var">time</span></a></span><span>
</span><span id="line-55"></span><span>
</span><span id="line-56"></span><span>    </span><span class="annot"><a href="#local-6989586621679070671"><span class="hs-identifier hs-type">timeNanoseconds</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int64"><span class="hs-identifier hs-type">Int64</span></a></span><span>
</span><span id="line-57"></span><span>    </span><span id="local-6989586621679070671"><span class="annot"><span class="annottext">timeNanoseconds :: Int64
</span><a href="#local-6989586621679070671"><span class="hs-identifier hs-var hs-var">timeNanoseconds</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679070673"><span class="hs-identifier hs-var">timePicoseconds</span></a></span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int64 -&gt; Int64
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Real.html#div"><span class="hs-operator hs-var">`div`</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><span class="hs-number">1000</span></span><span>
</span><span id="line-58"></span><span>
</span><span id="line-59"></span><span>    </span><span class="annot"><a href="#local-6989586621679070669"><span class="hs-identifier hs-type">timeSeconds</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int64"><span class="hs-identifier hs-type">Int64</span></a></span><span>
</span><span id="line-60"></span><span>    </span><span class="annot"><a href="#local-6989586621679070668"><span class="hs-identifier hs-type">nanoseconds</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int64"><span class="hs-identifier hs-type">Int64</span></a></span><span>
</span><span id="line-61"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621679070669"><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679070669"><span class="hs-identifier hs-var">timeSeconds</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679070668"><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679070668"><span class="hs-identifier hs-var">nanoseconds</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679070671"><span class="hs-identifier hs-var">timeNanoseconds</span></a></span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int64 -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&gt;=</span></span><span> </span><span class="annot"><span class="annottext">Int64
</span><span class="hs-number">86400000000000</span></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int64
</span><span class="hs-number">86399</span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679070671"><span class="hs-identifier hs-var">timeNanoseconds</span></a></span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int64 -&gt; Int64
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><span class="hs-number">86399000000000</span></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679070671"><span class="hs-identifier hs-var">timeNanoseconds</span></a></span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int64 -&gt; (Int64, Int64)
forall a. Integral a =&gt; a -&gt; a -&gt; (a, a)
</span><a href="../../base/src/GHC.Real.html#divMod"><span class="hs-operator hs-var">`divMod`</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><span class="hs-number">1000000000</span></span><span>
</span><span id="line-62"></span><span>
</span><span id="line-63"></span><span>    </span><span class="annot"><a href="#local-6989586621679070659"><span class="hs-identifier hs-type">seconds</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int64"><span class="hs-identifier hs-type">Int64</span></a></span><span>
</span><span id="line-64"></span><span>    </span><span id="local-6989586621679070659"><span class="annot"><span class="annottext">seconds :: Int64
</span><a href="#local-6989586621679070659"><span class="hs-identifier hs-var hs-var">seconds</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679070675"><span class="hs-identifier hs-var">days</span></a></span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int64 -&gt; Int64
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><span class="hs-number">86400</span></span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int64 -&gt; Int64
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679070669"><span class="hs-identifier hs-var">timeSeconds</span></a></span><span>
</span><span id="line-65"></span><span>
</span><span id="line-66"></span><span>    </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Word32 -&gt; SystemTime
</span><a href="Data.Time.Clock.Internal.SystemTime.html#MkSystemTime"><span class="hs-identifier hs-var">MkSystemTime</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679070659"><span class="hs-identifier hs-var">seconds</span></a></span><span> </span><span class="annot"><span class="annottext">(Word32 -&gt; SystemTime) -&gt; Word32 -&gt; SystemTime
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Word32
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679070668"><span class="hs-identifier hs-var">nanoseconds</span></a></span><span>
</span><span id="line-67"></span><span>
</span><span id="line-68"></span><span class="annot"><a href="Data.Time.Clock.System.html#systemEpochAbsolute"><span class="hs-identifier hs-type">systemEpochAbsolute</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Time.Clock.Internal.AbsoluteTime.html#AbsoluteTime"><span class="hs-identifier hs-type">AbsoluteTime</span></a></span><span>
</span><span id="line-69"></span><span id="systemEpochAbsolute"><span class="annot"><span class="annottext">systemEpochAbsolute :: AbsoluteTime
</span><a href="Data.Time.Clock.System.html#systemEpochAbsolute"><span class="hs-identifier hs-var hs-var">systemEpochAbsolute</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Day -&gt; AbsoluteTime
</span><a href="Data.Time.Clock.Internal.AbsoluteTime.html#taiNominalDayStart"><span class="hs-identifier hs-var">taiNominalDayStart</span></a></span><span> </span><span class="annot"><span class="annottext">Day
</span><a href="Data.Time.Clock.System.html#systemEpochDay"><span class="hs-identifier hs-var">systemEpochDay</span></a></span><span>
</span><span id="line-70"></span><span>
</span><span id="line-71"></span><span class="hs-comment">-- | Convert 'SystemTime' to 'AbsoluteTime', matching zero 'SystemTime' to midnight of 'systemEpochDay' TAI.</span><span>
</span><span id="line-72"></span><span class="annot"><a href="Data.Time.Clock.System.html#systemToTAITime"><span class="hs-identifier hs-type">systemToTAITime</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Time.Clock.Internal.SystemTime.html#SystemTime"><span class="hs-identifier hs-type">SystemTime</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Time.Clock.Internal.AbsoluteTime.html#AbsoluteTime"><span class="hs-identifier hs-type">AbsoluteTime</span></a></span><span>
</span><span id="line-73"></span><span id="systemToTAITime"><span class="annot"><span class="annottext">systemToTAITime :: SystemTime -&gt; AbsoluteTime
</span><a href="Data.Time.Clock.System.html#systemToTAITime"><span class="hs-identifier hs-var hs-var">systemToTAITime</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Time.Clock.Internal.SystemTime.html#MkSystemTime"><span class="hs-identifier hs-type">MkSystemTime</span></a></span><span> </span><span id="local-6989586621679070656"><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679070656"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621679070655"><span class="annot"><span class="annottext">Word32
</span><a href="#local-6989586621679070655"><span class="hs-identifier hs-var">ns</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span>
</span><span id="line-74"></span><span>    </span><span class="annot"><a href="#local-6989586621679070654"><span class="hs-identifier hs-type">diff</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Time.Clock.Internal.DiffTime.html#DiffTime"><span class="hs-identifier hs-type">DiffTime</span></a></span><span>
</span><span id="line-75"></span><span>    </span><span id="local-6989586621679070654"><span class="annot"><span class="annottext">diff :: DiffTime
</span><a href="#local-6989586621679070654"><span class="hs-identifier hs-var hs-var">diff</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int64 -&gt; DiffTime
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679070656"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">DiffTime -&gt; DiffTime -&gt; DiffTime
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word32 -&gt; DiffTime
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Word32
</span><a href="#local-6989586621679070655"><span class="hs-identifier hs-var">ns</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">DiffTime -&gt; DiffTime -&gt; DiffTime
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span> </span><span class="annot"><span class="annottext">DiffTime
</span><span class="hs-number">1E-9</span></span><span>
</span><span id="line-76"></span><span>    </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">DiffTime -&gt; AbsoluteTime -&gt; AbsoluteTime
</span><a href="Data.Time.Clock.Internal.AbsoluteTime.html#addAbsoluteTime"><span class="hs-identifier hs-var">addAbsoluteTime</span></a></span><span> </span><span class="annot"><span class="annottext">DiffTime
</span><a href="#local-6989586621679070654"><span class="hs-identifier hs-var">diff</span></a></span><span> </span><span class="annot"><span class="annottext">AbsoluteTime
</span><a href="Data.Time.Clock.System.html#systemEpochAbsolute"><span class="hs-identifier hs-var">systemEpochAbsolute</span></a></span><span>
</span><span id="line-77"></span><span>
</span><span id="line-78"></span><span class="hs-comment">-- | The day of the epoch of 'SystemTime', 1970-01-01</span><span>
</span><span id="line-79"></span><span class="annot"><a href="Data.Time.Clock.System.html#systemEpochDay"><span class="hs-identifier hs-type">systemEpochDay</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Time.Calendar.Days.html#Day"><span class="hs-identifier hs-type">Day</span></a></span><span>
</span><span id="line-80"></span><span id="systemEpochDay"><span class="annot"><span class="annottext">systemEpochDay :: Day
</span><a href="Data.Time.Clock.System.html#systemEpochDay"><span class="hs-identifier hs-var hs-var">systemEpochDay</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Day
</span><a href="Data.Time.Calendar.Days.html#ModifiedJulianDay"><span class="hs-identifier hs-var">ModifiedJulianDay</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">40587</span></span><span>
</span><span id="line-81"></span></pre></body></html>